﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace FSY.Globals
{
    /// <summary>
    /// This module contains global utility function, constants, and enumerations.
    /// </summary>
    #region enum
    //action on database
    public enum DataProviderAction
    {
        Insert = 0,
        Delete = 1,
        Update = 2,
        NotSet = 3
    }
    public enum SqlExecuteType
    {
        DataSet = 0,
        DataTable = 1,
        IDataReader = 2,
        NonQuery = 3,
        Scalar = 4,
        XmlReader = 5
    }
    public enum AddressType
    {
        IPv4 = 0,
        IPv6 = 1
    }   
    #endregion  
 
    public class Common
    {
        public static int GetTotalRecords(IDataReader dr)
        {
            int total = 0;
            if (dr.Read())
            {
                try
                {
                    total = Convert.ToInt32(dr[""]);
                }
                catch
                {
                    total = -1;
                }
            }
            return total;
        }
    }
}
